// 云函数入口文件
const cloud = require('wx-server-sdk')
var rp = require('request-promise');
cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  let url = event.url;
  let data = event.info;
  let token = event.token
  console.log(data)
  return await rp({
    url:url,
    method:'POST',
    json:true,
    formData:data,
    headers:{
      "content-Type": "application/x-www-form-urlencoded",
      "token":token
    }
  })
  .then(function(res){
    return res
  })
  .catch(function(res){
    console.log(res)
    return '请求失败'
  })
}